﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using S.Organization.Domian.dto;
using S.Organization.Domian.Model;
using S.Organization.Infrastructure;

namespace S.Organization.API.Controllers
{
    /// <summary>
    /// 报表
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class PromptReportController : ControllerBase
    {
        private readonly IBaseRepository<Subcultivation> Subcultivation;
        private readonly HttpClient _httpClient;
        public PromptReportController(IBaseRepository<Subcultivation> repository,   HttpClient httpClient)
        {
            Subcultivation = repository;
        }


        /// <summary>
        /// 测试
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult Get() 
        {

            return Ok();
        }

        /// <summary>
        /// 配种
        /// </summary>
        [HttpGet]
        public async void Hybridization()
        {
            HttpResponseMessage response = await _httpClient.GetAsync("http://10.31.56.6:8000/RouteRead/api/Pregnants/PregnantAllInfo");

            if (response.IsSuccessStatusCode)
            {
                string responseBody = await response.Content.ReadAsStringAsync();
                Pregnant pregnant = JsonConvert.DeserializeObject<Pregnant>(responseBody);
            
            }
          


        }
    }
}
